/**
 * API 配置文件
 */

/** API 基础配置 */
export const API_CONFIG = {
  /** 基础URL */
  BASE_URL: import.meta.env.VITE_API_BASE_URL,
  /** 默认超时时间（毫秒） */
  TIMEOUT: 10000,
  /** 默认重试次数 */
  RETRY_COUNT: 2,
  /** 请求头 */
  HEADERS: {
    'Content-Type': 'application/json',
  },
}

/** HTTP 状态码 */
export const HTTP_STATUS = {
  OK: 200,
  CREATED: 201,
  NO_CONTENT: 204,
  BAD_REQUEST: 400,
  UNAUTHORIZED: 401,
  FORBIDDEN: 403,
  NOT_FOUND: 404,
  INTERNAL_SERVER_ERROR: 500,
  BAD_GATEWAY: 502,
  SERVICE_UNAVAILABLE: 503,
} as const

/** 业务状态码 */
export const BUSINESS_CODE = {
  SUCCESS: 201,
  FAIL: -1,
  TOKEN_EXPIRED: 401,
  PERMISSION_DENIED: 403,
} as const

/** API 端点常量 */
export const API_ENDPOINTS = {
  // 用户相关
  USER: {
    INFO: 'user/info',
    UPDATE: 'user/update',
  },
  // 内部推荐相关
  INTERNAL_REFERRAL: {
    CURRENT_USER: 'internalReferral/currentUser',
    WORKSHOPS: 'internalReferral/workshops',
    WORKSHOP_PROPOSER: 'internalReferral/workshopProposer',
    SUBMIT: 'internalReferral/submit',
  },
  // 简历相关
  RESUME: {
    EDUCATION_INFO: 'resume/educationInfo',
    WORK_INFO: 'resume/workExperienceInfo',
    FAMILY_INFO: 'resume/familyInfo',
    EMERGENCY_CONTACT: 'resume/emergencyContact',
    RESUME_INFO: 'resume/resumeInfo',
    GET_INTERNAL_REFERRAL_INFO: 'resume/getInternalReferralInfo',
    GET_LAST_DEPT: 'resume/getLastDept',
    APPLICATION_SOURCE: 'resume/applicationSource',
  },
  // 实名认证相关
  AUTH: {
    ID_CARD: 'resume/idCard',
  },
  // 其他业务模块可以在这里添加\
  // 权限管理
  PERMISSION: {
    ENABLE_EDIT: 'permission/enable/edit',
  },
  // 标签管理
  TAGS: {
    LIST: 'positionTag/page',
    CREATE: 'positionTag/create',
    UPDATE: 'positionTag/update',
    DELETE: 'positionTag/delete',
  },
  // 岗位管理
  POSITION_MANAGE: {
    LIST: 'positionManage/page',
    CREATE: 'positionManage/create',
    UPDATE: 'positionManage/update',
    DELETE: 'positionManage/delete',
    GET_INFO: 'positionManage/original-data',
  },
  // 岗位基础数据
  BASE_DATA: {
    POSITION_PAGE: 'baseData/position/page',
  },
  // 海报生成
  POSTER: {
    GENERATE: 'poster/generate',
    PREVIEW: 'poster/{id}/preview',
  },
  // 草稿箱管理
  DRAFTS: {
    LIST: 'api/draftbox/list/page',
    CREATEEDIT: 'api/draftbox/create',
  },
  // 二维码生成
  QRCODE: {
    GENERATE: 'qrcode/generate',
  },
  // 题目预览
  QUESTION_PREVIEW: {
    PREVIEW: 'questionPreview/preview',
  },
} as const
